use axum::{Json, http::StatusCode};
use my_rust_core::shared::date_helper;
use serde_json::{Value, json};

pub fn get_data_response(data: Value) -> (StatusCode, Json<Value>) {
    (
        StatusCode::OK,
        Json(json!({
            "success": true,
            "payload": data,
        })),
    )
}

pub fn get_error_response(
    http_status: StatusCode,
    error: &str,
    message: &str,
    path: &str,
) -> (StatusCode, Json<Value>) {
    (
        http_status,
        Json(json!({
            "success": false,
            "timestamp": date_helper::get_timestamp(),
            "status": http_status.as_u16(),
            "error": error,
            "message": message,
            "path": path,
        })),
    )
}
